Skip to content

Fix streamable HTTP SSE exhaustion - #2517

Open
pradeep-ramola wants to merge 5 commits into
modelcontextprotocol:mainfrom
pradeep-ramola:fix-streamable-http-sse-exhaustion
Open

Fix streamable HTTP SSE exhaustion#2517
pradeep-ramola wants to merge 5 commits into
modelcontextprotocol:mainfrom
pradeep-ramola:fix-streamable-http-sse-exhaustion

Conversation

@pradeep-ramola

Copy link
Copy Markdown

Fixes #2098

Summary

Updates StreamableHTTPClientTransport so the standalone GET SSE channel does not silently become unusable after reconnect exhaustion.

This change:

  • raises the default Streamable HTTP SSE reconnection retry count from 2 to 10
  • records when the standalone GET SSE stream exhausts reconnect attempts
  • fails subsequent sends immediately with a clear error instead of POSTing into a dead response channel
  • preserves existing per-request stream exhaustion behavior via onRequestStreamEnd
  • includes response text in failed SSE-open errors when statusText is empty

Testing

  • corepack pnpm --filter @modelcontextprotocol/client exec vitest run test/client/streamableHttp.test.ts
  • corepack pnpm --filter @modelcontextprotocol/client typecheck
  • corepack pnpm --filter @modelcontextprotocol/client build
  • corepack pnpm --filter @modelcontextprotocol/client exec prettier --ignore-path ../../.prettierignore --check src/client/streamableHttp.ts test/client/streamableHttp.test.ts
  • corepack pnpm --filter @modelcontextprotocol/client exec eslint src/client/streamableHttp.ts

@pradeep-ramola
pradeep-ramola requested a review from a team as a code owner July 19, 2026 06:21
@changeset-bot

changeset-bot Bot commented Jul 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 152a73a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/client Patch
@modelcontextprotocol/core Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/server-legacy Patch
@modelcontextprotocol/codemod Patch
@modelcontextprotocol/core-internal Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2517

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2517

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2517

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2517

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2517

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2517

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2517

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2517

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2517

commit: 152a73a

@pradeep-ramola
pradeep-ramola force-pushed the fix-streamable-http-sse-exhaustion branch from 614cb47 to 0ace7f6 Compare July 19, 2026 06:32

@knoal knoal left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing via MCE A/B pilot 10 (sophia@hermes.local).

Summary

Fix streamable HTTP SSE exhaustion. 197 LOC, 3 files. Changes the default maxRetries from 2 to 10, suggesting the reconnection logic needed more attempts before giving up. Throws a clear error when a request is sent after the stream is exhausted.

APPROVE — real fix for SSE reconnection logic. The default of 2 retries was too aggressive for flaky networks; 10 is more appropriate.

— sophia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StreamableHTTPClientTransport: 2-retry SSE reconnect ceiling + silent-success after exhaustion

2 participants